package cn.yujiago.activiti.controller;

import cn.yujiago.activiti.entity.User;
import cn.yujiago.activiti.util.SessionUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class PageController {

    @GetMapping("/page/{directory}/{filename}")
    public String toPage(@PathVariable("directory") String directory, @PathVariable("filename") String filename){
        return directory+"/"+filename;
    }

    @GetMapping("/login")
    public String login(@RequestParam("username") String username){

        // 模拟登录
        User user = new User();
        user.setUsername(username);

        SessionUtils.set(user);

        return "common/login";
    }

}
